﻿using System;
using System.Collections.Generic;
using System.Text;

namespace EmbeddedSharp.Core.Function.Maths {

    /// <summary>
    /// Log
    /// </summary>
    [Function("powerE", "Gives the power of base", "a=powerE(10);", "a==522.735")]
    public class PowerENode : FuncNode {
        public PowerENode()
            : base("powerE") {
        }

        public override FuncNode GetReversedFunction(int index) {
            return new LnNode();
        }

        public override object Evaluate() {
            if (Parameters.Count == 0) {
                throw new ArgumentException("usage: powere(value)");
            }

            double ret = Convert.ToDouble(Parameters[0].Evaluate());
            return System.Math.Pow(ret, 2.71828).ToString();
        }
    }
}
